Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming
Calling methods from inside a class
You can directly access methods from within the class where they are defined by invoking the method name. This includes all methods implemented directly within the class definition and all
PUBLICandPROTECTEDmethods implemented in any super class of the class hierarchy. Invoking an overridden method executes the method defined in the bottom-most subclass of any class hierarchy in which the invoking class is a part.This is the syntax to invoke a method from inside a class:
Element descriptions for this syntax diagram follow:
return-variableThe name of the variable to hold any return value.
method-nameThe name of an accessible method in the class hierarchy.
[parameter[ ,parameter] ... ]The parameters of the method. For more information on the syntax of
parameter, see the “Parameter passing syntax” reference entry in OpenEdge Development: Progress 4GL Reference .The compiler verifies that the parameters used in the method invocation are consistent with parameters defined for the method. The compiler verifies that the number, mode and data type of these parameters match exactly. There is no implicit conversion of any data types when passing method parameters. However, Progress does allow a dynamic temp-table or ProDataSet to be passed to static temp-table or ProDataSet parameter (respectively), and similarly for passing a static temp-table or ProDataSet to a corresponding dynamic temp-table or ProDataSet parameter.
Note: If the parameter is a class or interface type, the parameter is passed by value as an object reference. The effect of passing an object reference parameter is identical to assigning one object reference to another. For more information, see the "Defining an object reference as a parameter" section.The following is an example from two of the sample classes, where
acme.myObjs.Common.CommonObjis a super class of the classacme.myObjs.CustObj:
The constructor in
acme.myObjs.CustObjinvokes thePROTECTEDmethodErrorHandler( )within its class hierarchy by directly calling the method by its name:
Comparison with procedure-based programming
Methods do not require a separately specified prototype in the class where they are invoked, as user-defined functions do in the procedure where they are invoked.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |